Add freeplay recording with in-app preview and MIDI export#395
Conversation
PolyMeilex
left a comment
There was a problem hiding this comment.
btw code forrmating is quite random, folow the official Rust formating rules.
|
Looks like a good idea btw! |
Consolidate freeplay preview state and UI handling so the recorder playback path is easier to follow and maintain. This also carries the live MIDI input fix for devices that encode note release as NoteOn with velocity 0, keeping keyboard state aligned with recorder semantics.
|
hi @PolyMeilex, Thanks for the detailed review. I’ve done my best to revise the structure and style so the change is easier to follow and reads more cleanly. While working through the feedback, I also found and fixed a potential bug in keyboard.rs: some MIDI devices encode note release as NoteOn with velocity 0, so that case now gets handled explicitly. If you see anything else that should be adjusted, please leave a comment!😄 |
I already normalize the midi input long before it reaches the app code to avoid the need for doing if vel == 0 checks in multiple places, it's done right here https://github.com/PolyMeilex/Neothesia/blob/master/neothesia%2Fsrc%2Finput_manager%2Fmod.rs#L37 I will take a look at the code tomorrow, but at a glance it looks like what I had in mind so should be good. |
|
ok, have reverted that part. Thanks~ |
Prevent controller-only recordings, such as sustain pedal input/only note off, from being treated as previewable or saveable takes.
|
Also, added test coverage for edge cases where the recording contains only pedal or note-off MIDI events, since those should not generate a preview. |
|
Thanks! |
Intro
Hi! I’ve been using Neothesia and really enjoy it. To support personal practice, I added a freeplay recording feature that captures live MIDI input, converts the take into a playable song, and allows saving it locally as a MIDI file.
Summary
This PR introduces an in-app recording flow: when recording stops, the app builds a preview of the take directly—no external reload required. It also adds a preview UI with record/save/play/pause, seeking, progress tracking, measure markers, and waterfall/note rendering, all integrated with existing scene components. Supporting changes include in-memory SMF construction and safeguards around playback math to handle zero-length or very short recordings gracefully.
File changed